﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BuShou.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS.ZhangWuGL.BuShou" Theme="Default"%>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title> 
    <script src="../../../../JS/jquery.js" type="text/javascript"></script>
    <script src="../../../../JS/AddEditCancel.js"></script>
    <script type="text/javascript">
        function setinfo() {
            if (txtBianHao.GetText() != '') {
                hdCollection.Set("id", txtBianHao.GetText());
                ASPxCallback1.PerformCallback("setinfo");
            }
            else {
                txtBianHao.Focus();
            }
        }

        //取消多收
        function qxbs() {
            if (confirm("确定取消补收吗？")) {
                hdCollection.Set("id", gvGrid.GetRowKey(gvGrid.GetFocusedRowIndex()));
                ASPxCallback1.PerformCallback("qxbs");
            }
        }

        //确定多收
        function qdbs() {
            hdCollection.Set("id", "1");
            ASPxCallback1.PerformCallback("qdbs");
        }


        //转出费用信息验证
        function Validate1() {
            if (txtYongHuH_out2.GetText() == "" || txtShuiLiangNY_out2.GetText() == "") {
                alert("转出费用信息用户号、水量年月为空，请先输入！");
            }
            else {
                //debugger;
                //先验证是否有加价开账记录
                //转出费用信息
                var yhh_out = txtYongHuH_out2.GetText();
                var ym_out = txtShuiLiangNY_out2.GetText();
                hdCollection.Set("yhh", yhh_out);
                hdCollection.Set("ym", ym_out);
                ASPxCallback1.PerformCallback("setinfo_out");
            }
        }

      

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (type == "setinfo") {
                var result = arr[2];
                if (result == "1") {
                    txtMingCheng.SetText(arr[3]);
                    txtShuiJia.SetText(arr[4]);
                }
                else {
                    alert("您输入的用户号不存在");
                }
            }
            else if (type == "qdbs") {
                if (arr[2] == "1") {
                    alert("确认补收成功");
                }
                else {
                    alert("补收失败");
                }
            }
           else if (type == "qxbs") {
                if (arr[2] == "1") {
                    alert("取消补收成功");
                    gvGrid.PerformCallback();
                }
                else {
                    alert("取消失败");
                }
            }

        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            补收
        </div>
        <div style="display: none;">
            <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
            <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
        </div>
        <div>
            <div>
                <table>
                    <tr>
                        <td>账务年月：</td>
                        <td>
                            <dx:ASPxTextBox runat="server" ID="txtZWNY" ClientEnabled="false" Width="80%"></dx:ASPxTextBox>
                        </td>
                    </tr>
                </table>
            </div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" Width="98%" Height="535px" AutoPostBack="true">
                        <TabPages>
                            <dx:TabPage Text="补收">
                                <ContentCollection>
                                    <dx:ContentControl Height="800px">
                                        <div style="width: 100%;">
                                            <div style="width: 50%; margin-left: 30%;">
                                                <table style="text-align: right; height: 270px; width: 100%;">
                                                   
                                                    <tr>
                                                        <td style="width: 20%;"><span style="font-size: 12px;">用户号：</span></td>
                                                        <td style="width: 50%;">
                                                            <dx:ASPxTextBox ID="txtBianHao" Width="60%" runat="server" ClientEnabled="true" ClientInstanceName="txtBianHao">
                                                                <ClientSideEvents KeyUp="function(s,e){inputNum(s);}" KeyPress="function(s,e){if (event.keyCode == 13) {setinfo(); };}" />
                                                            </dx:ASPxTextBox>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                      <tr>
                                                        <td><span style="font-size: 12px;">用户名：</span></td>
                                                        <td>
                                                            <dx:ASPxTextBox ID="txtMingCheng" Width="100%" runat="server" ClientEnabled="false" ClientInstanceName="txtMingCheng">
                                                            </dx:ASPxTextBox>
                                                        </td>
                                                    </tr> 
                                                    <tr>
                                                        <td><span style="font-size: 12px;">水价：</span></td>
                                                        <td>
                                                            <dx:ASPxTextBox ID="txtShuiJia" Width="60%" runat="server" ClientEnabled="false" ClientInstanceName="txtShuiJia">
                                                                <ClientSideEvents  KeyPress="function(s,e){if (event.keyCode == 13) { Validate1(); };}" />
                                                            </dx:ASPxTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span style="font-size: 12px;">补收类型：</span></td>
                                                        <td>
                                                            <dx:ASPxComboBox ID="cmbBuShouLX" ClientInstanceName="cmbBuShouLX" runat="server" ClientEnabled="true" Width="60%">
                                                                <Items>
                                                                    <dx:ListEditItem Text="一般补收" Value="1" />
                                                                    <dx:ListEditItem Text="稽查科补收" Value="2" />
                                                                </Items>
                                                            </dx:ASPxComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span style="font-size: 12px;">补收水量：</span></td>
                                                        <td>
                                                            <dx:ASPxTextBox ID="txtBuShouSL" Width="60%" runat="server" ClientEnabled="true" ClientInstanceName="txtBuShouSL">
                                                                <ClientSideEvents KeyUp="function(s,e){inputNum(s);}"/>
                                                            </dx:ASPxTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span style="font-size: 12px;">补收金额：</span></td>
                                                        <td>
                                                            <dx:ASPxTextBox ID="txtBuShouJE" Width="60%" runat="server" ClientEnabled="true" ClientInstanceName="txtBuShouJE">
                                                            </dx:ASPxTextBox>
                                                        </td>
                                                    </tr>
                                                     <tr>
                                                        <td><span style="font-size: 12px;">备注：</span></td>
                                                        <td>
                                                            <dx:ASPxMemo ID="memoBeiZhu" Width="100%" runat="server" ClientEnabled="true" ClientInstanceName="memoBeiZhu">
                                                            </dx:ASPxMemo>
                                                        </td>
                                                    </tr> 
                                                    <tr>
                                                        <td>
                                                        <dx:ASPxButton ID="btnBuShou" runat="server" Text="补收" ClientInstanceName="btnBuShou" UseSubmitBehavior="false" AutoPostBack="false">
                                                            <ClientSideEvents Click="function(s,e){qdbs();}" />
                                                        </dx:ASPxButton>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        </td>
                                                        <td style="text-align:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <dx:ASPxButton ID="btnChaXun" runat="server" Text="查看" ClientInstanceName="btnChaXun" UseSubmitBehavior="false" AutoPostBack="false">
                                                            <%--<ClientSideEvents Click="function(s,e){qdClick();}" />--%>
                                                        </dx:ASPxButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                    </dx:ContentControl>
                                </ContentCollection>
                            </dx:TabPage>
                            <dx:TabPage Text="取消补收">
                                <ContentCollection>
                                    <dx:ContentControl>
                                         <div>
                                             <div>
                                                 <dx:ASPxButton runat="server" ID="btnsx" Text="刷新" OnClick="btnsx_Click">

                                                 </dx:ASPxButton>
                                             </div>
                                            <dx:ASPxGridView ID="gvGrid" ClientInstanceName="gvGrid" runat="server" AutoGenerateColumns="False" KeyFieldName="ID" 
                                                EnableCallBacks="false"   Width="100%" OnCustomCallback="gvGrid_CustomCallback" >
                                                <Columns>
                                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="80" >
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="400">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="N_JINE" Caption="金额" Width="80">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_BUSHOURQ" Caption="补收账务年月" Width="90">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_TIANJIAR" Caption="操作员" Width="90">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="D_TIANJIARQ" Caption="补收日期" Width="85" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                                    </dx:GridViewDataTextColumn>
                                                   <%-- <dx:GridViewDataTextColumn FieldName="ID" Caption="ID" Width="5%">
                                                    </dx:GridViewDataTextColumn>--%>
                                                </Columns>
                                                <Settings VerticalScrollBarMode="Visible" VerticalScrollableHeight="400" HorizontalScrollBarMode="Auto" />
                                                <SettingsPager Mode="EndlessPaging" PageSize="100" AlwaysShowPager="true" FirstPageButton-Visible="true" />
                                                <Settings ShowFooter="True" />
                                                <SettingsBehavior AllowFocusedRow="True"  ColumnResizeMode="Control" />
                                                <SettingsBehavior ProcessFocusedRowChangedOnServer="true" />
                                                <%--<Settings VerticalScrollableHeight="200" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                                                <SettingsBehavior ProcessFocusedRowChangedOnServer="true" />--%>
                                            </dx:ASPxGridView>
                                        </div>
                                        <br />
                                        <div>
                                            <table align="right">
                                                <tr>
                                                    <td>
                                                        <dx:ASPxButton ID="btnQuXiaoBS" runat="server" Text="取消补收" AutoPostBack="false"  UseSubmitBehavior="false" >
                                                           <ClientSideEvents  Click="function(s,e){qxbs();}"/>
                                                        </dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </dx:ContentControl>
                                </ContentCollection>
                            </dx:TabPage>
                        </TabPages>
                    </dx:ASPxPageControl>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>
